﻿<!--

/**
*  Some check input function  
*/

function checkTel(str) {   
  var re = /^(((\()?\d{2,4}(\))?[-(\s)*]){0,2})?(\d{7,8})$/;   
  if(re.test(str)){   
  	return true;   
  }
  else{   
  	return false;   
  }   
}

/* delete left space */
function ltrim(s){
    return s.replace( /^\s*/, ""); 
}

/* delete right space */
function rtrim(s){
    return s.replace( /\s*$/, "");
}

/* delete all space */
function trim(s){
    return rtrim(ltrim(s));
}

/* check if empty */
function IsEmpty(_str){
    var tmp_str = trim(_str);
    return tmp_str.length == 0;
}

/* check email address */
function IsMail(str){
    var tempstr = trim(str);
    var pattern = /^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*$/;
    return pattern.test(tempstr);
}

/* whether or not number */
function IsNumber(str){
    var tmpstr = trim(str);
    var pattern = /^[0-9]/;
    return pattern.test(tmpstr);
}

/* check url */
function IsURL(url){
    var sTemp = trim(url);
    var pattern = /(.*\/){0,}([^\.]+).*/ig;
    return pattern.test(sTemp);
}

/* check mobile phone number */
function IsMobile(str){
    var tmpstr = trim(str);
    var pattern = /13|15\d{9}/;
    return pattern.test(tmpstr);
}

/* check zip */
function IsZip(str){
    var tmpstr = trim(str);
    var pattern = /^\d{4,6}?$/g;
    return pattern.test(tmpstr);
}

/* check ip */
function IsIP(str) {
	var tempstr = trim(str);
	var pattern = /(\d+)\.(\d+)\.(\d+)\.(\d+)/g;
	return pattern.text(tempstr);
}

function StrLen(str, len) {
	if(str.length == len)
		return true;
	else
		return false;
}


function setTab(area,id,tab_normal,tab_cur) {
    var tabArea=document.getElementById(area);
    var contents=tabArea.childNodes;
   
    for(i=0; i<contents.length; i++) {
        if(contents[i].className=='tabcontent'){contents[i].style.display='none';}
       
    }
    
    if (document.getElementById(id) != null)
       document.getElementById(id).style.display='';
    var tabs=document.getElementById(area+"tabs").getElementsByTagName('a');
    
    for(i=0; i<tabs.length; i++) { tabs[i].className= tab_normal; }
          
          document.getElementById(id+'tab').className= tab_cur;
          document.getElementById(id+'tab').blur();
          
}


function g(o){return document.getElementById(o);} 
  //如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick; 

function HoverLi(perfix,n,alltag,normaltab,hovertab){ 
  //如果有N个标签,就将i<=N; 
   for(var i=1;i<=alltag;i++){g(perfix+'tb_'+i).className=normaltab;}g(perfix+'tb_'+n).className=hovertab; 
}

function xHoverLi(perfix,n,alltag,normaltab,hovertab){ 
//如果有N个标签,就将i<=N; 
   for(var i=1;i<=alltag;i++){g(perfix+'tb_'+i).className=normaltab;}g(perfix+'tb_'+n).className=normaltab; 
 
}    
 

